/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Stones;

import Actors.Actor;
import Model.*;
import java.awt.image.BufferedImage;

/**
 *
 * @author Snowangelic
 */
public abstract class Stone {

    public final int UP_DIRECTION = 1;
    public final int LEFT_DIRECTION = 2;
    public final int RIGHT_DIRECTION = 3;
    public final int DOWN_DIRECTION = 4;

    BufferedImage image;
    Case myCase;

    Stone(){

    }

    public double[] getImpulse(Actor actor) {
        return null;
    }

    public void update(long dtime){};

    public BufferedImage getImage(){
        return image;
    }

    public void setCase(Case myCase){
        this.myCase=myCase;
    }

    //public EnigmaModel getModel(){
      //  return myCase.getModel();
    //}

    public int getXIndex(){
        return myCase.getXIndex();
    }

    public int getYIndex(){
        return myCase.getYIndex();
    }

    public void changed(){
        myCase.setStoneChanged(true);
    }

    public void bounce(Actor actor,int direction){
        if(direction==UP_DIRECTION){
            actor.setY((getYIndex()*32)-11);
            actor.setDy(0-actor.getDy());
        }
        else if(direction==LEFT_DIRECTION){
            actor.setX(((getXIndex()*32)-11));
            actor.setDx(0-actor.getDx());
        }
        else if(direction==RIGHT_DIRECTION){
            actor.setX(((getXIndex()+1)*32)+10);
            actor.setDx(0-actor.getDx());
        }
        else if(direction==DOWN_DIRECTION){
           actor.setY(((getYIndex()+1)*32)+10);
           actor.setDy(0-actor.getDy());
        }
    }
}
